using System;
using System.Collections.Generic;

namespace LibraryImport
{
    public static partial class Artists
    {
        /// <summary>
        /// Sorts and replaces duplicates and null-strings
        /// </summary>
        /// <param name="ArtistNames"></param>
        /// <returns>Returns a string collection of artist names</returns>
        private static String[] SmoothArtistNames(List<String> ArtistNames)
        {
            List<String> SmoothArtistNames = new List<string>();
            
            ArtistNames.Sort();

            for (int i = 0, offset = 0; i < ArtistNames.Count; i += offset)
            {
                offset = ArtistNames.LastIndexOf(ArtistNames[i], i) - i + 1;
                SmoothArtistNames.Add(ArtistNames[i]);
            }
            
            return SmoothArtistNames.ToArray();
        }
    }
}